﻿using System;
using DB.Context;
using NetCoreDemo.Core.ICoreService;

namespace NetCoreDemo.Core.CoreServiceImp
{
    //暂时没用到
    public class UnitOfWork : IUnitOfWork, IDisposable
    {
        #region 数据上下文

        /// <summary>
        /// 数据上下文
        /// </summary>
        private readonly TestContext _context;
        public UnitOfWork(TestContext context)
        {
            _context = context;
        }

        #endregion
        public bool Commit()
        {
            return _context.SaveChanges() > 0;
        }
        public void Dispose()
        {
            _context?.Dispose();
            GC.SuppressFinalize(this);
        }
    }
}
